import Base from '../base.js'
export default class student extends Base {
    render() {
        this.$app.html(`
        <table class="layui-table">
            <colgroup>
                <col width="150">
                <col width="200">
                <col>
            </colgroup>
            <thead>
                <tr>
                <th>name</th>
                <th>age</th>
                <th>gender</th>
                <th>score</th>
                <th>address</th>
                </tr> 
            </thead>
            <tbody>
            </tbody>
        </table>
        `)
    }
    handle() {
        $.ajax({
            type: 'get',
            url: '/student/show',
            dataType: 'json',
            success: (data) => {
                $('tbody').html(data.map(item => `
               <tr>
               <td>${item.name}</td>
               <td>${item.age}</td>
               <td>${item.gender}</td>
               <td>${item.score}</td>
               <td>${item.address}</td>
             </tr>`))
            }
        })
    }
}